package com.example.societiesSystem.service.impl;

import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.societiesSystem.entity.Activities;
import com.example.societiesSystem.entity.Activities;
import com.example.societiesSystem.mapper.ActivitiesMapper;
import com.example.societiesSystem.service.IActivitiesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 社团活动信息表 服务实现类
 * </p>
 *
 * @author 周欢
 * @since 2025-05-27
 */
@Service
public class ActivitiesServiceImpl extends ServiceImpl<ActivitiesMapper, Activities> implements IActivitiesService {

    @Override
    public IPage<Activities> pageAll(Long pageIndex, Long pageSize, Long token, String teamName, String activeName) {
        IPage<Activities> page = new Page<>(pageIndex, pageSize);
        LambdaQueryWrapper<Activities> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(Activities::getTeamId, token);
        queryWrapper.like(CharSequenceUtil.isNotBlank(teamName), Activities::getTeamName, teamName);
        queryWrapper.like(CharSequenceUtil.isNotBlank(activeName), Activities::getName, activeName);
        return this.page(page, queryWrapper);
    }
}
